<?php

namespace app\api\model;
use think\Model;

class AdminUser extends Model {
//    protected $name = 'admin_user';

    public function role()
    {
        return $this->belongsToMany(Role::class, UserRole::class);
    }

    public static function userdetail($username){
        $model = new static;

        return $model->where('username', $username)->find();

    }

//    public function getUserRole(){
////        return  $this->belongsTo(UserRole::class, 'user_id');
//        return $this->hasOne(UserRole::class, 'user_id');
//    }
//
//    public function romote(){
//        return $this->hasOneThrough(Role::class,UserRole::class,'user_id','user_role_id');
//    }
}
